#include "entity.h"

#include "objectmanager.h"

static ObjectManager* ObjectManagerInstance = nullptr;

ObjectManager::ObjectManager() {

	m_EntityManager = new EntityManager();
	m_SystemManager = new SystemManager();

	m_entityCounter = 0;
}

ObjectManager* ObjectManager::GetInstance() {
	if(ObjectManagerInstance == nullptr) {
		ObjectManagerInstance = new ObjectManager();
	}

	return ObjectManagerInstance;
}

std::shared_ptr<Entity> ObjectManager::CreateEntity() {

	Entity* entity = new Entity(m_entityCounter++);

	std::shared_ptr<Entity> pointer = std::shared_ptr<Entity>(entity);

	m_EntityManager->AddEntity(pointer);

	return pointer;
}